package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * @Author: 廖卓斯
 * @CreateTime: 2024-10-24
 * @Description:
 * @Version: 1.0
 */
@Mapper
public interface UserMapper {

    /**
     * 根据openid 查询用户
     * @param openid
     * @return
     */
    @Select("select * from user where openid=#{openid}")
    User getByOpenId(String openid);

    /**
     * 插入数据
     * 通过xml返回主键值 useGeneratedKeys="true" keyProperty="id"
     * @param user
     */
    void insert(User user);

    @Select("select * from user where id=#{userId}")
    User getById(Long userId);
}
